package com.hb.C_Lambda表达式和集合.D_集合

fun main() {
    val list1 = listOf(8, 9, 10)
    val numbersMap1 = mapOf("key1" to list1, "key2" to list1, "key3" to list1, "key4" to list1,"key5" to list1)
    val numbersMap2 = mapOf("key1" to list1, "key2" to list1, "key3" to list1, "key4" to list1,"key5" to list1)
    val numbersMap3 = mapOf("key1" to list1, "key2" to list1, "key3" to list1, "key4" to list1,"key5" to list1)

   val list= listOf(numbersMap1,numbersMap2,numbersMap3)
    val a=list.map {
        //println(it)
        println( it.values.flatten())
        //返回给定数组中所有数组的所有元素的单个列表。
        it.values.flatten()
    }.sumBy {
        println(it)
        it.size
    }
    println(a)

println("-------------")
    val deepArray = arrayOf(
        arrayOf(1),
        arrayOf(2, 3),
        arrayOf(4, 5, 6)
    )

    println(deepArray.flatten()) // [1, 2, 3, 4, 5, 6]

    val deepList = listOf(listOf(1), listOf(2, 3), listOf(4, 5, 6))
    println(deepList.flatten()) // [1, 2, 3, 4, 5, 6]
}